package com.ray.aop;

import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;

public class BeforeAop implements MethodBeforeAdvice
{

    /**
     * @param method
     * @param args
     * @param target
     * @throws Throwable
     */
    @Override
    public void before(Method method, Object[] args, Object target) throws Throwable
    {
        System.out.println("--------------------");
        System.out.println("before method：" + method.getName());
        for (int i = 0; i < args.length; i++)
        {
            System.out.println("before args：" + args[i]);
            args[i] = (Integer) args[i] + 100;
        }

        System.out.println("before target：" + target.toString());
        System.out.println("--------------------");
    }
}
